import asyncio
from dataclasses import dataclass


@dataclass
class Test:
    num: int = 0
    get_num: any = None
    set_num: any = None


async def test_get_num(this):
    await asyncio.sleep(1)
    return this.num


async def test_set_num(this, num):
    await asyncio.sleep(2)
    this.num = num


async def test():
    t = Test(10, get_num=test_get_num, set_num=test_set_num)
    ret = await t.get_num(t)
    print(ret)  # 10
    await t.set_num(t, 20)
    ret = await t.get_num(t)
    print(ret)  # 20

asyncio.run(test())